#include <unistd.h>
#include <signal.h>
#include <stdio.h>

void func(int num)
{
	printf("func: %d\n", num);
	sleep(10);
}

int main()
{
	sigset_t set;
	sigset_t oldset;
	sigset_t curset;
	sigemptyset(&set);
	sigemptyset(&oldset);
	sigemptyset(&curset);
	sigaddset(&set, SIGINT);
	sigprocmask(SIG_BLOCK, &set, &oldset);

	struct sigaction oldact;
	struct sigaction act = {
		.sa_mask = curset,
		.sa_flags = 0,
		.sa_handler = func,
	};
	sigaction(SIGQUIT, &act, &oldact);
	
	while(1)
	{
		sigpending(&curset);
		printf("SIGINT:%d\n", sigismember(&curset,SIGINT));
		printf("SIGQUIT:%d\n", sigismember(&curset,SIGQUIT));
		sleep(1);
	}

	return 0;
}
